home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
mac
/
data
/
xxi_appendice_dvd.swf
/
scripts
/
__Packages
/
CAppendiceZoom.as
< prev
next >
Wrap
Text File
|
2007-11-08
|
8KB
|
209 lines
class CAppendiceZoom extends mx.core.UIObject
{
function CAppendiceZoom()
{
super();
this.Hide();
this.doLater(this,"init");
}
function init(Void)
{
this.mMarginRect = new Object();
this.mMarginRect.top = 42;
this.mMarginRect.left = 42;
this.mMarginRect.bottom = 51;
this.mMarginRect.right = 42;
this.mMaxZoom = 100;
this.mMinZoom = 25;
this.mc_ZoomPanelOrgRect = new Object();
this.mc_ZoomPanelOrgRect.x = this.mc_ZoomPanel._x;
this.mc_ZoomPanelOrgRect.y = this.mc_ZoomPanel._y;
this.mc_ZoomPanelOrgRect.width = this.mc_ZoomPanel.width;
this.mc_ZoomPanelOrgRect.height = this.mc_ZoomPanel.height;
this.mc_ZoomCloseBtn.useHandCursor = false;
this.mGrabAlpha = 10;
this.mc_ZoomPanel.addEventListener("progress",mx.utils.Delegate.create(this,this.onImageLoadingProgress));
this.mc_ZoomPanel.addEventListener("complete",mx.utils.Delegate.create(this,this.onImageLoadingComplete));
this.mc_ZoomPanel.setStyle("borderStyle","none");
this.mc_ZoomPanel.__set__scrollDrag(true);
this.mc_ZoomTitle.html = true;
this.mc_ZoomTitle.embedFonts = _global.gUseEmbeddedFont;
this.mc_ZoomTitle.styleSheet = _global.gStyleManager.GetCSS();
this.mc_ZoomProgress._visible = false;
this.mc_ZoomBkg.onPress = this.ClickGrab;
this.mc_ZoomBkg.useHandCursor = false;
this.mc_ZoomTitleRollover.onRollOver = mx.utils.Delegate.create(this,this.onZoomTitleRollOver);
this.mc_ZoomTitleRollover.onRollOut = mx.utils.Delegate.create(this,this.onZoomTitleRollOut);
this.mc_ZoomTitleRollover.onDragOut = mx.utils.Delegate.create(this,this.onZoomTitleRollOut);
}
function ClickGrab()
{
}
function LayoutWindow()
{
this.mc_ZoomProgress._visible = false;
var _loc2_ = {x:0,y:0};
this.globalToLocal(_loc2_);
this.mc_ZoomGrab._x = _loc2_.x;
this.mc_ZoomGrab._y = _loc2_.y;
this.mc_ZoomGrab._width = Stage.width;
this.mc_ZoomGrab._height = Stage.height;
this.mc_ZoomGrab.onPress = function()
{
this._parent.NextFrame();
};
this.mc_ZoomGrab.useHandCursor = false;
this.mc_ZoomGrab._alpha = this.mGrabAlpha;
this.mc_ZoomGrab._visible = true;
}
function ZoomImage(inHtmlTitolo, inUrl)
{
this.LayoutWindow();
this.mc_ZoomTitle.text = "<span class=\'s_titoloContributo\'>" + inHtmlTitolo + "</span>";
this.mc_ZoomTitle.hscroll = 0;
if(inUrl != this.mc_ZoomPanel.__get__contentPath())
{
this.mc_ZoomPanel.__set__contentPath(inUrl);
this.mc_ZoomProgress.Setprogress(0);
this.mc_ZoomProgress._visible = true;
}
this.mc_ZoomProgress._visible = false;
this._visible = true;
this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"zoom",action:"open"});
}
function ZoomContributo(inContributo, inFrom)
{
this.LayoutWindow();
this.mc_ZoomTitle.text = "<span class=\'s_titoloContributo\'>" + inContributo.mTitolo + "</span>";
this.mc_ZoomTitle.hscroll = 0;
var _loc2_ = inContributo.GetPath();
if(_loc2_ != this.mc_ZoomPanel.__get__contentPath())
{
this.mc_ZoomPanel.__set__contentPath(_loc2_);
this.mc_ZoomProgress.Setprogress(0);
this.mc_ZoomProgress._visible = true;
}
this._visible = true;
this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"zoom",action:"open"});
}
function Hide(Void)
{
this._visible = false;
}
function Close(Void)
{
this.Hide();
this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"zoom",action:"close"});
}
function onImageLoadingProgress(eventObject)
{
if(this.mc_ZoomPanel.getBytesTotal() > 0)
{
this.mc_ZoomProgress.Setprogress(this.mc_ZoomPanel.getBytesLoaded() / this.mc_ZoomPanel.getBytesTotal() * 100);
}
}
function onImageLoadingComplete(eventObject)
{
this.mc_ZoomProgress._visible = false;
}
function FitImageToPanelArea()
{
this.mc_ZoomPanel.__get__content()._orgWidth = this.mc_ZoomPanel.__get__content()._width;
this.mc_ZoomPanel.__get__content()._orgHeight = this.mc_ZoomPanel.__get__content()._height;
this.mc_ZoomProgress._visible = false;
this.ScaleContent(0);
}
function ScaleContent(inScale)
{
if(!this.mc_ZoomPanel.__get__content())
{
return undefined;
}
this.UnScaleContent();
var _loc5_ = this.mc_ZoomPanel.__get__width() - 18;
var _loc8_ = this.mc_ZoomPanel.__get__height() - 18;
var _loc4_ = 0;
var _loc3_ = 0;
var _loc2_ = undefined;
if(inScale == 0)
{
var _loc7_ = _loc5_ / this.mc_ZoomPanel.__get__content()._width;
var _loc6_ = _loc8_ / this.mc_ZoomPanel.__get__content()._height;
if(_loc7_ > _loc6_)
{
_loc4_ = Math.floor((_loc5_ - this.mc_ZoomPanel.__get__content()._width * _loc6_) / 2);
_loc2_ = _loc6_ * 100;
}
else
{
_loc3_ = Math.floor((_loc8_ - this.mc_ZoomPanel.__get__content()._height * _loc7_) / 2);
_loc2_ = _loc7_ * 100;
}
}
else
{
_loc2_ = inScale;
_loc4_ = Math.max(0,Math.floor((_loc5_ - this.mc_ZoomPanel.__get__content()._orgWidth * _loc2_ / 100) / 2));
_loc3_ = Math.max(0,Math.floor((_loc8_ - this.mc_ZoomPanel.__get__content()._orgHeight * _loc2_ / 100) / 2));
}
this.mc_ZoomPanel.__get__content()._xscale = this.mc_ZoomPanel.__get__content()._yscale = _loc2_;
this.mc_ZoomPanel._x = this.mc_ZoomPanelOrgRect.x + _loc4_;
this.mc_ZoomPanel._y = this.mc_ZoomPanelOrgRect.y + _loc3_;
var _loc11_ = this.mc_ZoomPanelOrgRect.width;
if(_loc4_ > 0)
{
_loc11_ -= _loc4_;
}
var _loc9_ = this.mc_ZoomPanelOrgRect.height;
if(_loc3_ > 0)
{
_loc9_ -= _loc3_;
}
this.mc_ZoomPanel.invalidate();
}
function UnScaleContent()
{
if(!this.mc_ZoomPanel.__get__content())
{
return undefined;
}
this.mc_ZoomPanel.__get__content()._xscale = this.mc_ZoomPanel.__get__content()._yscale = 100;
this.mc_ZoomPanel.__get__content()._x = this.mc_ZoomPanel.__get__content()._y = 0;
this.mc_ZoomPanel._x = this.mc_ZoomPanelOrgRect.x;
this.mc_ZoomPanel._y = this.mc_ZoomPanelOrgRect.y;
}
function ZoomIn()
{
if(!this.mc_ZoomPanel.__get__content())
{
return undefined;
}
if(this.mc_ZoomPanel.__get__content()._xscale < this.mMaxZoom)
{
this.ScaleContent(Math.min(this.mc_ZoomPanel.__get__content()._xscale + 25,this.mMaxZoom));
}
}
function ZoomOut()
{
if(!this.mc_ZoomPanel.__get__content())
{
return undefined;
}
if(this.mc_ZoomPanel.__get__content()._xscale > this.mMinZoom)
{
this.ScaleContent(Math.max(this.mc_ZoomPanel.__get__content()._xscale - 25,this.mMinZoom));
}
}
function setEnabled(enable)
{
}
function onZoomTitleRollOver()
{
_root.gTooltipManager.show(this.mc_ZoomTitle.htmlText,null);
}
function onZoomTitleRollOut()
{
_root.gTooltipManager.hide();
}
}